import request from '@/api/request'
import axios from 'axios'
import qs from 'qs'
    const VUE_APP_BASE_API_DONG = localStorage.getItem("share_weixin_shareurl")?localStorage.getItem("share_weixin_shareurl"):""
    console.log("=========VUE_APP_BASE_API_DONG",VUE_APP_BASE_API_DONG)
// const VUE_APP_BASE_API_DONG="https://xingwu.bigchun.com/"
// const VUE_APP_BASE_API_DONG="http://shop.com/"
    const front_http="https://xingwufront.bigchun.com/"
    const weixinapp_http = 'https://xctong.bigchun.com/'
    const IMGUrl='https://oss.bigchun.com/'
    const base_name="醒悟大健康"
//  const VUE_APP_BASE_API_DONG = "https://yggs.bigchun.com/"
    const httpdong = {

        /**
         * method:请求
         * @params url 请求地址
         * @params params 请求参数
         * */
        //列表+详情
        get(url, params) {
            const config = {
                method: 'get',
                url: url
            }
            if (params) config.params = params
            return request(config)


        },
        // 请求微信api
        post2(url, params) {
            const config = {
                method: 'post',
                url: weixinapp_http + url,
            }
            if (params) config.data = qs.stringify(params)
            console.log(config);
            return request(config)
        },
        //新增
        post(url, params) {
            if(params && params.weixinApi){
                const config = {
                    method: 'post',
                    url: weixinapp_http + url,
                }
                if (params) config.data = qs.stringify(params)
                console.log(config);
                return request(config)
            }
            const config = {
                method: 'post',
                url: url,
            }
            if (params) config.data = qs.stringify(params)
            console.log(config);
            return request(config)
        },

    }

export default {
    httpdong,
    base_name,
    front_http,
    VUE_APP_BASE_API_DONG,
    IMGUrl
}
